﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mql2Fdk
{
	/// <summary>
	/// Provides color functionality.
	/// </summary>
	public struct color
	{
		#region construction
		/// <summary>
		/// Initializes a new instance of color.
		/// </summary>
		/// <param name="value">datetime value</param>
		public color(int value) : this()
		{
			m_value = value;
		}
        /// <summary>
        /// Initializes a new instance of color.
        /// </summary>
        /// <param name="value">datetime value</param>
        public color(double value)
            : this()
        {
            m_value = (int) value;
        }
		#endregion
		#region operators
		/// <summary>
		/// The operator creates color instance from integer value.
		/// </summary>
		/// <param name="arg">datetime value</param>
		/// <returns></returns>
		public static implicit operator color(int arg)
		{
			return new color(arg);
		}
		/// <summary>
		/// The operator converts color instance to int type.
		/// </summary>
		/// <param name="arg">datetime value</param>
		/// <returns></returns>
		public static implicit operator int(color arg)
		{
			return arg.m_value;
		}
        /// <summary>
        /// The operator converts color instance to int type.
        /// </summary>
        /// <param name="arg">datetime value</param>
        /// <returns></returns>
        public static implicit operator double(color arg)
        {
            return arg.m_value;
        }
		#endregion
		/// <summary>
		/// Returns formatted string for the color instance.
		/// </summary>
		/// <returns></returns>
		public override string ToString()
		{
			string result = this.m_value.ToString();
			return result;
		}
		private int m_value;
	}
}
